home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_8.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
3KB
|
105 lines
function spawnHippo(xSpot)
{
var _loc1_ = enemyContainer.attachMovie("squidro","enemy" + eConCount++,eConCount);
_loc1_._x = xSpot;
_loc1_._y = (- _loc1_._height) / 2;
_loc1_.gotoAndStop(1);
_loc1_.energy = 150;
_loc1_.move = hippoMover;
_loc1_.Q1logic = baddyQ1;
_loc1_.Q2logic = baddyQ2;
_loc1_.Q3logic = baddyQ3;
_loc1_.Q4logic = baddyQ4;
_loc1_.hit = hippoHit;
this.isHit = false;
_loc1_.shoot = hippoShoot;
_loc1_.approaching = true;
_loc1_.shooting = false;
_loc1_.waiting = false;
_loc1_.sDelay = 0;
_loc1_.sCount = 0;
_loc1_.collide = baddyCollide;
}
function hippoMover()
{
var _loc1_ = this;
if(_loc1_.isHit)
{
_loc1_.isHit = false;
_loc1_.resetColor();
}
if(_loc1_.approaching)
{
_loc1_._y += 2;
if(_loc1_._y >= 75)
{
_loc1_.approaching = false;
_loc1_.gotoAndStop(4);
_loc1_.shooting = true;
}
}
else if(_loc1_.shooting)
{
_loc1_.sDelay = _loc1_.sDelay + 1;
if(_loc1_.sDelay == 20 && _loc1_.sCount < 3)
{
_loc1_.gotoAndPlay("shoot");
_loc1_.sCount = _loc1_.sCount + 1;
_loc1_.sDelay = 0;
}
if(_loc1_.sCount == 3 && _loc1_.sDelay == 20)
{
_loc1_.shooting = false;
_loc1_.waiting = true;
_loc1_.sDelay = 0;
_loc1_.sCount = 0;
_loc1_.gotoAndStop(1);
}
}
else if(_loc1_.waiting)
{
_loc1_.sCount = _loc1_.sCount + 1;
if(_loc1_.sCount == 100)
{
_loc1_.sCount = 0;
_loc1_.waiting = false;
_loc1_.shooting = true;
_loc1_.gotoAndStop(4);
}
}
}
function hippoShoot(xStart, yStart, xVel, yVel)
{
var _loc1_ = this;
playSound("sound.gun2");
var _loc2_ = eBullets.attachMovie("eBul1","bullet" + eBulletsCount++,eBulletsCount);
_loc2_._x = xStart;
_loc2_._y = yStart;
_loc2_.vel = new Vector(xVel,yVel);
_loc2_.vel.setLength(5);
_loc2_.onEnterFrame = function()
{
var _loc1_ = this;
_loc1_._x += _loc1_.vel.x;
_loc1_._y += _loc1_.vel.y;
if(_loc1_._x < 0 || _loc1_._x > 600 || _loc1_._y < 0 || _loc1_._y > 400)
{
_loc1_.removeMovieClip();
}
};
}
function hippoHit()
{
var _loc1_ = this;
_loc1_.setRGB(16777215);
_loc1_.isHit = true;
_loc1_.energy -= 5;
if(_loc1_.energy <= 0)
{
playSound("sound.missile.explode");
explode(_loc1_);
addScore(300);
baddyKillCount++;
}
}